<script type="text/javascript">
function tkb_getXmlHttpRequestObject() 
{	
	if (window.XMLHttpRequest) 
	{ // Mozilla, Safari,...
		return new XMLHttpRequest();		
	} 
	else if (window.ActiveXObject) 
	{ // IE
		try
		{
			return new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) 
		{
			try 
			{
				return new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (e)
			{
				alert('Cannot create XMLHTTP instance');
				return false;
			}
		}
	}

}

function js_del_img(p_nid)
{
	if(confirm('Are you sure you want to delete this images ? This action can not undo !'))
	{ 
		
		var obj_ajax 				= tkb_getXmlHttpRequestObject();
		str_g_hidden_base_url 		= '<?php echo base_url()."index.php/"?>';
		str_url						= str_g_hidden_base_url + 'do_news/del_img/'+p_nid;
		document.getElementById('div_img_thumb').innerHTML ='Please wait....';
		if (obj_ajax.readyState == 4 || obj_ajax.readyState  == 0) 
		{
			obj_ajax.open("POST", str_url, true);
			obj_ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
			obj_ajax.onreadystatechange = function()
			{
				if(obj_ajax.readyState == 4 && obj_ajax.status == 200)
				{
					 document.location.href =str_g_hidden_base_url + 'do_news/f_edit/'+p_nid;
				}
			}
			
		}
		obj_ajax.send(null);
	}	
}
</script>
<div id="ContentMessage">
	<div id="NoteContentMessage">
		<?php echo $get_message_notnull ?>
	</div>
	
	<div id="ErrorContentMessage">
		<?php echo $error_ctitle; ?>
		<?php echo $error_sec; ?>
		<?php echo $error_cat; ?>
		<?php echo $error_ccontent; ?>
		<?php echo $error_cshort_content; ?>
	</div>
</div>		
<form  name='form_main' id="form_main" method="post" action="<?php echo $link_page; ?>" enctype="multipart/form-data">	
<div id="SiteContent_main">			
	
	
	<div id="EditContent">
		<table class="EditStyle01" >
			<tbody>								

				<tr>
						<td class="key" width="150" align="right">
						<?php echo $lbl_title; ?><?php echo $get_icon_notnull; ?>					</td>
						<td width="">
							<input style="width:350px;" type="text" width="" name="txt_ctitle" value="<?php echo $txt_ctitle; ?>">					</td>
				</tr>
				
					<td class="key" width="150" align="right">
						<?php echo $lbl_short_content; ?><?php echo $get_icon_notnull; ?>					</td>
					 <td colspan="2" style="width:730px;height:200px;">
				  	<?php echo $this->fckeditor->Create('txt_cshort_content',$txt_cshort_content,'Basic');?>	</td>
				</tr>
				<tr>
					<td class="key" width="150" align="right">
						<?php echo $lbl_content; ?><?php echo $get_icon_notnull; ?>					</td>
					  <td colspan="2" style="width:730px;height:500px;">
				  	<?php  echo $this->fckeditor->Create('txt_ccontent',$txt_ccontent,'Basic');?>				  </td>
				</tr>
			<tbody>				
		</table>
		<div style="margin-bottom:50px;margin-left:180px;">
			<input type="button" name="btn_submit" style="width:80px;" value ="<?php echo $btn_update; ?>" 
							onclick ="js_SetSubmitButtonClick(this.form, this.name);" class="button"/>
													   
						<input name="btn_cancel" style="width:80px;" type="button" 
							   value = "<?php echo $btn_cancel; ?>"
							   onclick="location.href='<?php echo $link_cancel; ?> '" class="button"/>	
		</div>
	</div>
	<input name="hidden_nid" type="hidden" value = "<?php echo $nid; ?>"  />
	<input name="hidden_event" type="hidden" value = "<?php echo $event; ?>"  />
	<input type="hidden" name="hidden_button_click"  value = "" />	
	<input type="hidden" name="hidden_image_old"  value = "<?php echo $txt_cthumb_img; ?>" />	
</div>
</form>

<!-- BAT BUOC CAC FORM NHAP LIEU DEU PHAI DUNG SCRIPT NAY. -->

<script type="text/javascript" >
function js_VerifyBeforeSubmit (obj_form, btn_name) 
	{
		if (document.form_main.txt_user_name.value=='')
			{
				document.form_main.txt_ccode.focus();
				return false;
			}
		if (document.form_main.txt_password.value=='')
			{
				document.form_main.txt_password.focus();
				return false;
			}
		return false;		
	}		

/*-------------------------------------------------------------------------------------
* Tokaban Corp 1509
* Package : TKB PHP SYSTEM CODE
*--------------------------------------------------------------------------------------
* huanlv77 - 1509/06/28.
*--------------------------------------------------------------------------------------
* Ham submit form co su dung su kien hidden de truyen bien flag dieu khien.
* Nhiem vu gan gia tri cho bien hidden dieu khien nut nhan submit cua form.
* Dung de controller nhan biet nut submit nao duoc nhan tren giao dien de xu ly tren server script.
* Ham nay duoc dung chung cho toan bo ung dung.
* Nen xay dung thanh chuan de tai su dung cho nhung du an khac.
*--------------------------------------------------------------------------------------*/
function js_SetSubmitButtonClick(obj_form, btn_name) 
	{
		obj_form.hidden_button_click.value = btn_name;
		obj_form.submit();		
	}

</script>